<?php include('header.php')?>
	<title>公众号配置</title>
</head>
<body>
	<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="position:static;">
		<div class="container-fluid">
			<ul class="nav navbar-nav">
				<li><a href="http://www.12301.cc"><i class="fa fa-reply-all"></i>返回系统</a></li>
			</ul>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row">
            <?php include('leftbar.php')?>
            <div class="col-xs-12 col-sm-9 col-lg-10">
                <div class="clearfix">
                    <ul class="nav nav-tabs nav-width">
                        <li class="active"><a href="javascript:;">1. 公众号验证</a></li>
                        <li class="normal"><a href="javascript:;">2. 设置公众号信息</a></li>
                        <li class="normal"><a href="javascript:;">3. 引导页面</a></li>
                    </ul>
                    <form action="add_account.html" method="post" class="form-horizontal" role="form" id="form1">
                        <input name="account_id" value="0" type="hidden"/>
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                公众号验证
                            </div>
                            <div class="panel-body">
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">公众登录用户</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="wxusername" id="username" class="form-control" value="" autocomplete="off">
                                        <span class="help-block">请输入您的公众平台用户名</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">公众登录密码</label>
                                    <div class="col-sm-9">
                                        <input type="password" name="wxpassword" id="password" class="form-control" value="">
                                        <span class="help-block">请输入您的公众平台密码</span>
                                    </div>
                                </div>
                                <div id="imgverifyWrap" class="form-group" style="display:none">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">登录验证码</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="verify" class="txt grid-1 alpha pin form-control" value="" autocomplete="off">
                                        <span class="help-inline"><img id="imgverify"> <a href="javascript:;" id="changCode">换一张</a></span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-12">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input name="nextStep" type="button" value="下一步" class="btn btn-primary">
                                <input type="hidden" name="token" value="cd0c85b7">
                            </div>
                        </div>
                    </form>
                </div>
            </div>

		</div>
	</div>
	<div style="display:none" id="gMaskLayer" class="gMaskLayer"></div>
    <script>
        $(document).ready(function(){
            $("input[name=nextStep]").on('click', function(){
                if ($("#username").val()=='' || $("#password").val()=='') {
                    alert('用户名或密码不能为空')
                    return false;
                }
                var param = {
                    action:'LoginWx',
                    user:$("#username").val(),
                    pwd:$("#password").val()
                };
                $.post('ichat.php', param , function(ret){
                    if (ret.status=='fail') {
                        if (ret.code=='-8') {
                            $("#imgverifyWrap").show();
                        } else {
                            alert(ret.msg);
                        }
                    } else {
                        console.log(ret);
                        $("input[name=account_id]").val(ret.key);
                        $("#form1").submit();
                    }
                }, 'json');
            });
            $('#changCode').on('click', function(){
                var user = $('input[name=wxusername]').val();
                $('#imgverify').attr('src','ichat.php?action=Image&u='+user+'&s='+Math.random(1));
            });
        });
    </script>
	<?php include('footer.php')?>
</body>